package com.rocksea.app.entry;

import android.os.Parcel;
import android.os.Parcelable;

import java.util.List;

/**
 * Created by 吴志华 on 2017/7/31.
 * 报检单的数据结构
 */

public class InspectionForm implements Parcelable{

    public String flag;
    public List<InspectionFormListBean> inspectionFormList;

    public InspectionForm() {
    }


    public static class InspectionFormListBean implements Parcelable{
        public boolean isTop = false;
        public int id;
        public int testedCounts;
        public String number;
        public String applyTime;
        public String structName;
        public String pierNum;
        public String centerMile;
        public String applyMethod;
        public String pileNum;
        public String applicantName;
        public String applicantTel;
        public String stressType;
        public String pileDiameter;
        public String desPileLength;
        public String holeMethod;
        public String concreteStrength;
        public String desVolume;
        public String receiver;
        public String sectId;
        public String sectName;
        public String siteId;
        public String siteName;
        public List<PileBean> pileList;
        public int pileCount;
        public String startMile;
        public String endMile;

        public InspectionFormListBean() {
        }

        protected InspectionFormListBean(Parcel in) {
            isTop = in.readByte() != 0;
            id = in.readInt();
            number = in.readString();
            applyTime = in.readString();
            structName = in.readString();
            pierNum = in.readString();
            centerMile = in.readString();
            applyMethod = in.readString();
            pileNum = in.readString();
            applicantName = in.readString();
            applicantTel = in.readString();
            stressType = in.readString();
            pileDiameter = in.readString();
            desPileLength = in.readString();
            holeMethod = in.readString();
            concreteStrength = in.readString();
            desVolume = in.readString();
            receiver = in.readString();
            sectId = in.readString();
            sectName = in.readString();
            siteId = in.readString();
            siteName = in.readString();
            pileList = in.createTypedArrayList(PileBean.CREATOR);
            pileCount = in.readInt();
            startMile = in.readString();
            endMile = in.readString();
        }

        @Override
        public void writeToParcel(Parcel dest, int flags) {
            dest.writeByte((byte) (isTop ? 1 : 0));
            dest.writeInt(id);
            dest.writeString(number);
            dest.writeString(applyTime);
            dest.writeString(structName);
            dest.writeString(pierNum);
            dest.writeString(centerMile);
            dest.writeString(applyMethod);
            dest.writeString(pileNum);
            dest.writeString(applicantName);
            dest.writeString(applicantTel);
            dest.writeString(stressType);
            dest.writeString(pileDiameter);
            dest.writeString(desPileLength);
            dest.writeString(holeMethod);
            dest.writeString(concreteStrength);
            dest.writeString(desVolume);
            dest.writeString(receiver);
            dest.writeString(sectId);
            dest.writeString(sectName);
            dest.writeString(siteId);
            dest.writeString(siteName);
            dest.writeTypedList(pileList);
            dest.writeInt(pileCount);
            dest.writeString(startMile);
            dest.writeString(endMile);
        }

        @Override
        public int describeContents() {
            return 0;
        }

        public static final Creator<InspectionFormListBean> CREATOR = new Creator<InspectionFormListBean>() {
            @Override
            public InspectionFormListBean createFromParcel(Parcel in) {
                return new InspectionFormListBean(in);
            }

            @Override
            public InspectionFormListBean[] newArray(int size) {
                return new InspectionFormListBean[size];
            }
        };
    }

    public static class PileBean implements Parcelable {
        public String pileId;
        public String pileNo;
        public String date;
        public String pileBottomH;
        public String pileTopH;
        public String actualvolume;

        public PileBean() {
        }

        protected PileBean(Parcel in) {
            pileId = in.readString();
            pileNo = in.readString();
            date = in.readString();
            pileBottomH = in.readString();
            pileTopH = in.readString();
            actualvolume = in.readString();
        }

        public static final Creator<PileBean> CREATOR = new Creator<PileBean>() {
            @Override
            public PileBean createFromParcel(Parcel in) {
                return new PileBean(in);
            }

            @Override
            public PileBean[] newArray(int size) {
                return new PileBean[size];
            }
        };

        @Override
        public int describeContents() {
            return 0;
        }

        @Override
        public void writeToParcel(Parcel dest, int flags) {
            dest.writeString(pileId);
            dest.writeString(pileNo);
            dest.writeString(date);
            dest.writeString(pileBottomH);
            dest.writeString(pileTopH);
            dest.writeString(actualvolume);
        }
    }

    protected InspectionForm(Parcel in) {
        flag = in.readString();
        inspectionFormList = in.createTypedArrayList(InspectionFormListBean.CREATOR);
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeString(flag);
        dest.writeTypedList(inspectionFormList);
    }

    @Override
    public int describeContents() {
        return 0;
    }

    public static final Creator<InspectionForm> CREATOR = new Creator<InspectionForm>() {
        @Override
        public InspectionForm createFromParcel(Parcel in) {
            return new InspectionForm(in);
        }

        @Override
        public InspectionForm[] newArray(int size) {
            return new InspectionForm[size];
        }
    };
}






